<!DOCTYPE html>
<html>
<head>
	<title>222</title>
	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
	<p id="content">
		log:
	</p>
	<input  id="inp">
	<button id="btn1">发送</button>
</body>
<script type="text/javascript">

	var worker = new SharedWorker('haredWorker.js');
	worker.port.start();
	worker.port.postMessage()
	$('#btn2').click(function(){
		var b = {msg:$('inp').val()}
		worker.port.postMessage(b)
	}) 
	worker.port.addEventListener('message', function(e){
		$('content').html('/n' + e.data.msg)
	}, false);
</script>
</html>